#ifndef RPCSERVER_H
#define RPCSERVER_H
#include <grpc++/grpc++.h>
#include "SingleClass.h"
#include <memory>
class userCenterServices;

class rpcServer:public SingleClass<rpcServer> {

public:
    //通过使用静态的once_flag,可以重复调用，但没有影响
    void start();
    void stop();
    ~rpcServer();
private:
    friend class SingleClass<rpcServer>;
    rpcServer();
   
    grpc::ServerBuilder build;
    void register_services();   //向rpc中注册服务

    //各种服务,在register_services中注册即可
    userCenterServices * _userCenterServices;   //注册服务
    std::unique_ptr<grpc::Server> server;   
};

#endif